﻿using System;
using System.Linq;
using System.Reflection;
using Styx.Helpers;

using Styx.Plugins;

namespace PetFighterBot
{
    public class LogicCreatorApi
    {
        private readonly PluginContainer _LogicCreatorCtn;
        private readonly Action _OnButtonPress;

        public LogicCreatorApi()
        {
            _LogicCreatorCtn = PluginManager.Plugins.FirstOrDefault(
                a => a.Name.Contains("LogicCreator"));
            if (_LogicCreatorCtn != null)
            {
                _OnButtonPress = _LogicCreatorCtn.Plugin.OnButtonPress;
            }
        }

        /// <summary>
        /// </summary>
        public bool HasLogicCreator()
        {
            return _LogicCreatorCtn != null ? true : false;
        }

        public void OnButtonPress()
        {
            if (_OnButtonPress != null) _OnButtonPress();
        }


    }
}
